package com.bidepan.validation.two;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;

@Configuration
@ComponentScan("com.bidepan.validation.two")
public class ValidationConfig {
    @Bean
    public LocalValidatorFactoryBean validator(){
        return new LocalValidatorFactoryBean();
    }

    @Bean(name = "user1")
    public User user(){
        User user = new User();
        user.setName("John Doe");
        user.setAge(-1);
        return user;
    }
    @Bean(name = "user2")
    public User user2(){
        User user = new User();
        user.setName("mike");
        user.setAge(200);
        return user;
    }
}
